package com.example.demo.service;

import com.example.demo.entity.UserInfo;
import com.example.demo.mapper.UserMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
@Service
public class UserService {

    @Resource
    private UserMapper mapper;

    // 插入用户
    @Transactional(propagation = Propagation.NESTED)
    public Integer addUser(UserInfo userInfo) {
        int result = mapper.addUser(userInfo);
//        int test = 10 / 0;
        return result;
    }
}
